package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.CremationFurnaceEntity;
import com.jinmdz.fmis.mapper.mapper.provider.CremationFurnaceProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * {2}Mapper
 *
 * @author generator
 * @date 2020-03-12 17:08
 */
public interface CremationFurnaceMapper {

    /**
     * 增加CremationFurnace
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @InsertProvider(type = CremationFurnaceProvider.class, method = "insertCremationFurnace")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertCremationFurnace(@Param("entity") CremationFurnaceEntity entity);

    /**
     * 删除CremationFurnace
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Update(" update cremation_furnace set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForCremationFurnace(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改CremationFurnace
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @UpdateProvider(type = CremationFurnaceProvider.class, method = "updateCremationFurnace")
    void updateCremationFurnace(@Param("entity") CremationFurnaceEntity entity);

    /**
     * 查询CremationFurnace实体
     *
     * @param id 主键
     * @return CremationFurnaceEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Select(" select id,deleted,furnace_type_code,furnace_code,furnace_describe,furnace_state,disable_state,sort,remark,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from cremation_furnace where id = #{id} and deleted = 0 limit 1 ")
    CremationFurnaceEntity getCremationFurnaceById(@Param("id") Integer id);

    /**
     * 查询CremationFurnace列表
     *
     * @param entity 数据实体
     * @return CremationFurnaceEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @SelectProvider(type = CremationFurnaceProvider.class, method = "listCremationFurnace")
    ArrayList<CremationFurnaceEntity> listCremationFurnace(@Param("entity") CremationFurnaceEntity entity);
}